package com.dongwu.manager.entity;

import com.dongwu.common.entity.BaseEntity;
import com.dongwu.manager.dto.SpecificationData;
import com.dongwu.security.entity.User;
import com.google.common.collect.Lists;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.List;

@Entity
public class Product extends BaseEntity<String> {

	/**
	 * 类型3
	 */
	public enum Type {

		/**
		 * 外部导入
		 */
		outimport,

		/**
		 * 从后台管理页面添加
		 */
		add,
	}

	// 商品名称
	private String name;
	// 商品价格
	private BigDecimal price;
	// 返还积分
	private Long rewardPoint;
	// 访问路径
	private String pathUrl;
	// 介绍
	@Column(columnDefinition = "Text")
	private String introduction;
	//轮播图
	@Column(columnDefinition = "Text")
	private String slideImage;

	// 外部商品编号
	private String outSn;
	// 平台添加的商品商家编码
	private String bussinesSn;
	// 平台添加的商品商家名称
	private String bussinesName;

	// 列表页图片
	private String image;
	
	// 视频地址
	private String video;
	// 规格名
	@Transient
	private String speName;
	// 规格值
	@Transient
	private String speVal;

	private String Specification;
	//短网址
	private String slink;
	
	@Transient
	private List<SpecificationData>  specificationList = Lists.newArrayList();
	
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "userid")
	private User user;

	private Type type;

	private Long sort;

	private String goodsid;

	private int ishot;

	@ManyToOne(cascade= {CascadeType.REFRESH})
	@JoinColumn(name="adsClassifyId")
	private AdsClassify adsClassify;

	//短网址
	public String getSlink() {
		return slink;
	}

	public void setSlink(String slink) {
		this.slink = slink;
	}

	public List<SpecificationData> getSpecificationList() {
		return specificationList;
	}

	public void setSpecificationList(List<SpecificationData> specificationList) {
		this.specificationList = specificationList;
	}
	
	public String getBussinesName() {
		return bussinesName;
	}

	public String getSpeName() {
		return speName;
	}
	
	public String getVideo() {
		return video;
	}

	public void setVideo(String video) {
		this.video = video;
	}

	public void setSpeName(String speName) {
		this.speName = speName;
	}

	public String getSpeVal() {
		return speVal;
	}

	public void setSpeVal(String speVal) {
		this.speVal = speVal;
	}

	public String getBussinesSn() {
		return bussinesSn;
	}

	public String getImage() {
		return image;
	}

	public String getIntroduction() {
		return introduction;
	}

	public String getName() {
		return name;
	}

	public String getOutSn() {
		return outSn;
	}

	public String getPathUrl() {
		return pathUrl;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public Long getRewardPoint() {
		return rewardPoint;
	}

	public String getSlideImage() {
		return slideImage;
	}

	public Long getSort() {
		return sort;
	}

	public String getSpecification() {
		return Specification;
	}

	public Type getType() {
		return type;
	}

	public User getUser() {
		return user;
	}

	public void setBussinesName(String bussinesName) {
		this.bussinesName = bussinesName;
	}

	public void setBussinesSn(String bussinesSn) {
		this.bussinesSn = bussinesSn;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setOutSn(String outSn) {
		this.outSn = outSn;
	}

	public void setPathUrl(String pathUrl) {
		this.pathUrl = pathUrl;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public void setRewardPoint(Long rewardPoint) {
		this.rewardPoint = rewardPoint;
	}

	public void setSlideImage(String slideImage) {
		this.slideImage = slideImage;
	}

	public void setSort(Long sort) {
		this.sort = sort;
	}

	public void setSpecification(String specification) {
		Specification = specification;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getGoodsid() {
		return goodsid;
	}

	public void setGoodsid(String goodsid) {
		this.goodsid = goodsid;
	}

	public int getIshot() {
		return ishot;
	}

	public void setIshot(int ishot) {
		this.ishot = ishot;
	}

	public AdsClassify getAdsClassify() {
		return adsClassify;
	}

	public void setAdsClassify(AdsClassify adsClassify) {
		this.adsClassify = adsClassify;
	}
}